import request from '@/utils/request'

// 查询小区列表
export function listCommunity(query) {
  return request({
    url: 'pms/community/list',
    method: 'get',
    params: query
  })
}
// 首页查询小区列表
export function getUserCommunity(query) {
  return request({
    url: 'pms/community/getUserCommunity',
    method: 'get',

  })
}
// 查询小区详细
export function getCommunity(id) {
  return request({
    url: 'pms/community/list', // 通常详情接口应为 /pms/community/{id}，如需调整请告知
    method: 'get',
    params: { id }
  })
}

// 新增小区
export function addCommunity(data) {
  data.communityId=undefined
  return request({
    url: 'pms/community/add?isCommunity=false',
    method: 'post',
    data: data
  })
}
// 获取小区列表
export function getAreas(data) {
  return request({
    url: '/system/area/getAreas',
    method: 'get',
    params: data
  })
}

// 编辑小区
export function updateCommunity(data) {
  return request({
    url: 'pms/community/edit?isCommunity=false',
    method: 'put',
    data: data
  })
}

// 删除小区
export function delCommunity(id) {
  return request({
    url: `pms/community/${id.toString()}`,
    method: 'delete'
  })
}
